import { playSuccess, playError, playPapa, playWater, playRing, playDingding } from './webAudio'
import { iswap } from '@ve/utils/pdaUtils'
export default function audio({ vm, action, done }) {
  console.log('声音index的vm', vm)
  // let type = action.extension.audioType.value ? 'OK' : 'ERROR'
  let type = action.extension.audioType.value
  console.log('请看你进来了方法：', iswap(), type)
  if (iswap() == 'WEB') {
    console.log('web方法', iswap())
    switch (type) {
      case 'success':
        playSuccess()
        break
      case 'error':
        playError()
        break
      case 'water':
        playWater()
        break
      case 'papa':
        playPapa()
        break
      case 'ring':
        playRing()
        break
      case 'ding':
        playDingding()
        break
      default:
        console.log('NoMusicType!')
        break
    }
    // type == 'OK' ? playSuccess() : playError()
  } else {
    console.log('安卓原生方法', iswap())
    window.$CIMC.playMusic(type, '')
  }
  done(null, {})
}
